#ifndef __PROTOCOL_H__
#define __PROTOCOL_H__

#include <string.h>
#include <stdlib.h>

#define MAX_MEMBER_NAME_LENGTH  64
#define MAX_MEMBER_ADDR_LENGTH  64
#define MAX_MEMBER_OCCU_LENGTH  64
#define MAX_CARD_TYPE_LENGTH    64
#define MAX_DATE_LENGTH         64


class Member
{
public:
    int iMid;
    char szName[MAX_MEMBER_NAME_LENGTH];
    char szAddress[MAX_MEMBER_ADDR_LENGTH];
    char szOccupation[MAX_MEMBER_OCCU_LENGTH];

    Member()
    {
        iMid = 0;
        memset(szName, 0, sizeof(szName));
        memset(szAddress, 0, sizeof(szAddress));
        memset(szOccupation, 0, sizeof(szOccupation));
    }

    Member(const char* name, const char* addr, const char* occu)
    {
        iMid = 0;
        strcpy(szName, name);
        strcpy(szAddress, addr);
        strcpy(szOccupation, occu);
    }
};

class Card
{
public:
    int iCid;
    char szType[MAX_CARD_TYPE_LENGTH];
    int iPrice;

    Card()
    {
        iCid = 0;
        memset(szType, 0, sizeof(szType));
        iPrice = 0;
    }

    Card(const char* type, const int price)
    {
        strcpy(szType, type);
        iPrice = price;
    }
};

class Order
{
public:
    int iRid;
    int iMid;
    int iCid;
    int iNum;
    char szStartDate[MAX_DATE_LENGTH];
    char szEndDate[MAX_DATE_LENGTH];
    int bStatus;
    Order()
    {
        iRid = iMid = iCid = iNum = 0;
        memset(szStartDate, 0, sizeof(szStartDate));
        memset(szEndDate, 0, sizeof(szEndDate));
        bStatus = 1;
    }
    Order(int mid, int cid, int num)
    {
        iMid = mid;
        iCid = cid;
        iNum = num;
    }
};

#endif // __PROTOCOL_H__
